#!/bin/sh
TAB=`echo "_" | tr "_" "\t"`


if [ $# -eq 0 ]
then
   echo 'INCLUDE=`pkg-config --cflags x11` ' > Makefile
   echo 'LIBS=`pkg-config --libs x11` -lm' >> Makefile
else
   if [ $1 = '--system=openbsd' ]
   then
      echo 'INCLUDE= `pkg-config --cflags x11` -I/usr/local/include' > Makefile
      echo 'LIBS= `pkg-config --libs x11` -lm -largp -L/usr/local/lib' >> Makefile
   fi
fi
echo "OBJECTS=rpexpose.o parse.o thumbnail.o gui.o assert.o" >> Makefile
echo "DESTDIR=/usr/local/bin" >> Makefile
echo "" >> Makefile
echo "all: rpexpose" >> Makefile
echo "" >> Makefile
echo 'rpexpose: ${OBJECTS}' >> Makefile
echo "${TAB}" '${CC} ${CFLAGS} ${OBJECTS} ${LIBS} -g -o $@ ' >> Makefile
echo "" >> Makefile
echo ".c.o: rpexpose.h" >> Makefile
echo "${TAB}" '${CC} ${CFLAGS} ${INCLUDE} -g -c $^' >> Makefile
echo "" >> Makefile
echo "install: rpexpose" >> Makefile
echo "${TAB}" 'cp rpthumb rpselect rpexpose ${DESTDIR}' >> Makefile
echo "${TAB}" "@echo" >> Makefile
echo "${TAB}" "@echo Add the following lines to your .ratpoisonrc file" >> Makefile
echo "${TAB}" "@echo addhook switchwin exec rpthumb" >> Makefile
echo "${TAB}" "@echo addhook quit exec rpexpose --clean" >> Makefile
echo "${TAB}" "@echo bind \<key\> exec rpselect" >> Makefile
echo "" >> Makefile
echo "clean:" >> Makefile
echo "${TAB}" "rm -f rpexpose *.gch *.o" >> Makefile
